package com.lxk.concurrency.example.syncContainer;

import java.util.Vector;

public class VectorExample2 {

	private static Vector<Integer> vector = new Vector<Integer>();

	public static void main(String[] args) {

		for (int i = 0; i < 10; i++) {
			vector.add(i);
		}
		
		System.out.println(vector);

		Thread thread1 = new Thread() {
			public void run() {
				for (int i = 0; i < vector.size(); i++) {
					System.out.println("remove:" + vector.remove(i));
				}
			}
		};

		Thread thread2 = new Thread() {
			public void run() {
				for (int i = 0; i < vector.size(); i++) {
					System.out.println("get:" + vector.get(i));
				}
			}
		};

		thread1.start();
	    thread2.start();
	}
}